package org.com.yz.dubbo.web.impl;

import org.com.yz.common.util.MyLog;
import org.com.yz.dal.dao.mapper.MchAccntMapper;
import org.com.yz.dal.dao.model.MchAccnt;
import org.com.yz.dubbo.web.service.CheckMchAccntService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 校验账户信息实现类
 */
@Service
public class CheckMchAccntServiceImpl implements CheckMchAccntService {

    private static final MyLog _log = MyLog.getLog(CheckMchAccntServiceImpl.class);

    @Autowired
    private MchAccntMapper mchAccntMapper;


    @Override
    public boolean getByMchId(MchAccnt accnt) {
        List<MchAccnt> list = mchAccntMapper.select(accnt);
        MchAccnt mchAccnt = null;
        if (list.size() > 0) {
            mchAccnt = list.get(0);
        }
        if (mchAccnt == null) {
            return false;//不存在
        }
        return true;
    }

    @Override
    public MchAccnt selectAccntInfo(MchAccnt accnt) {
        List<MchAccnt> list = mchAccntMapper.selectMchAccnt(accnt);
        if (list.size() > 0) {
            return list.get(0);//存在重复的
        }
        return null;
    }


}
